#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main (int argc, char const* argv[])
{
    int n, color_cnt, i, j, max, ans, hit;
    char s[16];
    char colors[1000][16];
    int cnt[1000];

    while (scanf("%d", &n) != EOF) {
        if (0 == n) break;
        memset(colors, 0, sizeof(char)*1000*16);
        memset(cnt, 0, sizeof(int)*1000);

        color_cnt = 0;
        for (i = 0; i < n; i++) {
            scanf("%s", s);
            hit = 0;
            for (j = 0; j < color_cnt; j++) {
                if (strcmp(s, colors[j]) == 0) {
                    cnt[j]++;
                    hit = 1;
                }
            }
            if (!hit) {
                strcpy(colors[i], s);
                cnt[color_cnt]++;
                color_cnt++;
            }
        }

        max = 0;
        for (i = 0; i < color_cnt; i++) {
            if (cnt[i] > max) {
                max = cnt[i];
                ans = i;
            }
        }

        printf("%s\n", colors[ans]);
    }

    return 0;
}
